import sqlite3

#连接数据库
conn = sqlite3.connect('test.db')
#创建游标
cursor = conn.cursor()
#创建表
#cursor.execute("create table user(id integer(11) primary key, name varchar(20))")
#插入数据
#sql = "insert into user values(1,root)"
#sql2 = "insert into user values(?,?)"
#cursor.execute(sql2,(2,"admin"))

#conn.commit()
#查询数据
sql = "select * from user"
#cursor.execute(sql)
#for row in cursor:
#    print(row[1])
result = cursor.execute(sql).fetchall()
#print(result)
for row in cursor.fetchall():
    print(row)